package com.aspose.cells;

import java.util.ArrayList;

final class zpv {
   static int a = 3;

   static com.aspose.cells.b.a.b.zt a(zn var0, zbo var1, zbcr var2, int var3, int var4, int var5) throws Exception {
      zbcp var6 = var2.c(var3);
      zif var7 = var6.v();
      zjd var8 = var6.D().b(var4);
      zpt var9 = var8.o();
      if (!var9.t()) {
         return new com.aspose.cells.b.a.b.zt(0.0F, 0.0F);
      } else {
         boolean var12 = false;
         ArrayList var10;
         ArrayList var11;
         if (var1.d() == 0) {
            var12 = var7.z().b;
            var10 = var7.z().c();
            var11 = var10;
         } else {
            var12 = var7.z().c;
            var10 = var7.z().d();
            var11 = var10;
            if (!var7.g().q() && var12) {
               var11 = var7.z().f();
            }
         }

         String var13 = var9.p();
         boolean var14 = var9.r();
         boolean var15 = var9.q();
         String var16 = var6.i();
         String var17 = "";
         if (a(var6.ag())) {
            Object var18 = var8.s();
            var17 = a(var7.al(), var18, var13, var14);
            if (var15) {
               var17 = a(var7.al(), var18, var8.t(), var8.u());
            }
         } else if (var12) {
            String var32 = var4 < var11.size() ? ((zfo)var11.get(var4)).c() : "";
            boolean var19 = var4 < var11.size() ? ((zfo)var11.get(var4)).b() : false;
            if (var15) {
               var13 = var32;
               var14 = var19;
            }

            if (var4 < var11.size() && var4 < var10.size()) {
               Object var20 = ((zfo)var10.get(var4)).a();
               int var21 = zhz.a(var20, var7.S());
               Object var22 = ((zfo)var11.get(var4)).a();
               if (var21 == -1) {
                  var17 = "";
               } else {
                  var17 = a(var7.al(), var22, var13, var14);
               }
            } else {
               var17 = "";
            }
         } else {
            var17 = var4 >= var1.l.size() ? "" : a(var1.c().al(), var1.l.get(var4), var13, var14);
         }

         zbo var33 = zbq.a(var1);
         double var34 = var8.v();
         var34 = var33.n() ? zbuk.f(var34) : var34;
         var34 = var33.n() ? var34 : var34 * Math.pow(10.0D, var33.Q().f());
         String var35 = a(var33.c().al(), var34, var13, var14);
         if (var15) {
            var35 = a(var33.c().al(), var34, var8.z(), var8.A());
         }

         String var36 = a(var7.al(), var8.B(), var13, var14);
         if (var15) {
            var36 = a(var8.h().al(), var8.B(), var8.C(), var8.D());
         }

         if (var8.H()) {
            var35 = com.aspose.cells.b.a.zr.a(var8.x());
         }

         String var23 = var9.l();
         com.aspose.cells.b.a.b.zg var24 = var9.a().h();
         int var25 = var9.m();
         int var26 = var9.n();
         int var27 = var9.o();
         com.aspose.cells.b.a.b.zt var28 = new com.aspose.cells.b.a.b.zt(0.0F, 0.0F);
         if (var9.e()) {
            var28 = new com.aspose.cells.b.a.b.zt((float)var9.x(), (float)var9.y());
         }

         String var29 = "";
         if (var9.s() == null) {
            if (var9.h()) {
               var29 = var29 + var16;
            }

            if (var9.d()) {
               if (!"".equals(var29)) {
                  var29 = var29 + var23;
               }

               var29 = var29 + var17;
            }

            if (var9.g()) {
               if (!"".equals(var29)) {
                  var29 = var29 + var23;
               }

               var29 = var29 + var35;
            }

            if (var9.i()) {
               if (!"".equals(var29)) {
                  var29 = var29 + var23;
               }

               var29 = var29 + var36;
            }
         } else {
            var29 = var9.s();
         }

         com.aspose.cells.b.a.b.zt var30 = new com.aspose.cells.b.a.b.zt((float)var5, (float)var7.b() * 0.5F);
         com.aspose.cells.b.a.b.zs var31 = zbsp.a(var0, var29, var25, var24, var30, var26, var27);
         if ("".equals(var29)) {
            return new com.aspose.cells.b.a.b.zt(0.0F, 0.0F);
         } else {
            return var9.e() ? new com.aspose.cells.b.a.b.zt((float)var31.b() + var28.b(), (float)var31.c()) : new com.aspose.cells.b.a.b.zt((float)var31.b(), (float)var31.c());
         }
      }
   }

   static void a(zn var0, zbo var1, zbcr var2, int var3, int var4, com.aspose.cells.b.a.b.zp var5) throws Exception {
      com.aspose.cells.b.a.b.zq var6 = new com.aspose.cells.b.a.b.zq((float)var5.c(), (float)var5.d(), (float)var5.e(), (float)var5.f());
      a(var0, var1, var2, var3, var4, var6);
   }

   static void a(zn var0, zbo var1, zbcr var2, int var3, int var4, com.aspose.cells.b.a.b.zq var5) throws Exception {
      zbcp var6 = var2.c(var3);
      zif var7 = var6.v();
      zjd var8 = var6.D().b(var4);
      zpt var9 = var8.o();
      com.aspose.cells.b.a.b.zq[] var10 = new com.aspose.cells.b.a.b.zq[]{var5};
      a(var10, var7);
      var5 = var10[0];
      if (var9.t()) {
         boolean var13 = false;
         ArrayList var11;
         ArrayList var12;
         if (var1.d() == 0) {
            var13 = var7.z().b;
            var11 = var7.z().c();
            var12 = var11;
         } else {
            var13 = var7.z().c;
            var11 = var7.z().d();
            var12 = var11;
            if (!var7.g().q() && var13) {
               var12 = var7.z().f();
            }
         }

         String var14 = var9.p();
         boolean var15 = var9.r();
         boolean var16 = var9.q();
         String var17 = var6.i();
         String var18 = "";
         boolean var19 = false;
         if (a(var6.ag())) {
            Object var20 = var8.s();
            var18 = a(var7.al(), var20, var14, var15);
            if (var16) {
               var18 = a(var7.al(), var20, var8.t(), var8.u());
               var19 = a(var20, var8.t());
            }
         } else if (var13) {
            String var43 = var4 < var12.size() ? ((zfo)var12.get(var4)).c() : "";
            boolean var21 = var4 < var12.size() ? ((zfo)var12.get(var4)).b() : false;
            if (var16) {
               var14 = var43;
               var15 = var21;
            }

            if (var4 < var12.size() && var4 < var11.size()) {
               Object var22 = ((zfo)var11.get(var4)).a();
               int var23 = zhz.a(var22, var7.S());
               Object var24 = ((zfo)var12.get(var4)).a();
               if (var23 == -1) {
                  var18 = "";
               } else {
                  var18 = a(var7.al(), var24, var14, var15);
               }

               if (var16) {
                  var19 = a(var22, var14);
               }
            } else {
               var18 = "";
            }
         } else {
            var18 = var4 >= var1.l.size() ? "" : a(var1.c().al(), var1.l.get(var4), var14, var15);
            if (var4 < var1.l.size() && var16) {
               var19 = a(var1.l.get(var4), var14);
            }
         }

         zbo var44 = zbq.a(var1);
         double var45 = var8.v();
         var45 = var44.n() ? zbuk.f(var45) : var45;
         var45 = var44.n() ? var45 : var45 * Math.pow(10.0D, var44.Q().f());
         String var46 = a(var7.al(), var45, var14, var15);
         boolean var47 = false;
         if (var16) {
            var46 = a(var7.al(), var45, var8.z(), var8.A());
            var47 = a((Object)var45, (String)var8.z());
         }

         if (var8.H()) {
            var46 = com.aspose.cells.b.a.zr.a(var8.x());
         }

         String var25 = a(var7.al(), var8.B(), var14, var15);
         if (var16) {
            var25 = a(var7.al(), var8.B(), var8.C(), var8.D());
         }

         String var26 = var9.l();
         com.aspose.cells.b.a.b.zg var27 = var9.a().h();
         Color var28 = var9.a().j();
         int var29 = var9.m();
         int var30 = var9.n();
         int var31 = var9.o();
         com.aspose.cells.b.a.b.zt var32 = new com.aspose.cells.b.a.b.zt((float)var9.x(), (float)var9.y());
         int var33 = (int)var5.f();
         int var34 = (int)var5.g();
         int var35 = (int)var5.h();
         int var36 = (int)var5.i();
         int var37 = var9.e() ? var33 - a : var33;
         int var38 = var34 - a;
         int var39 = var9.e() ? var35 + 2 * a : var35;
         int var40 = var36 + 2 * a;
         var9.a().a = new com.aspose.cells.b.a.b.zp(var37, var38, var39, var40);
         zax.a(var0, com.aspose.cells.a.c.zn.a(var9.a().a), var9.a().d());
         zama.a(var0, com.aspose.cells.a.c.zn.a(var9.a().a), var9.a().f());
         if (var9.e()) {
            com.aspose.cells.b.a.b.zq var41 = new com.aspose.cells.b.a.b.zq(var5.f(), var5.g(), var32.b(), var32.c());
            zalc.a(var0, var41, var6);
            var33 += (int)var32.b();
            var35 -= (int)var32.b();
         }

         String var48 = "";
         if (var9.s() == null) {
            if (var9.h()) {
               var48 = var48 + var17;
            }

            if (var9.d()) {
               if (!"".equals(var48)) {
                  var48 = var48 + var26;
               }

               var48 = var48 + var18;
            }

            if (var9.g()) {
               if (!"".equals(var48)) {
                  var48 = var48 + var26;
               }

               var48 = var48 + var46;
            }

            if (var9.i()) {
               if (!"".equals(var48)) {
                  var48 = var48 + var26;
               }

               var48 = var48 + var25;
            }
         } else {
            var48 = var9.s();
         }

         com.aspose.cells.b.a.b.zp var42 = new com.aspose.cells.b.a.b.zp(var33, var34, var35, var36);
         if (var19 || var47) {
            var28 = Color.getRed();
         }

         a(var0, var9, var42, var48, var29, var27, var28, var30, var31);
      }
   }

   public static void a(com.aspose.cells.b.a.b.zq[] var0, zif var1) throws Exception {
      if (var0[0].f() < (float)zhz.c) {
         var0[0].a((float)zhz.c);
      }

      if (var0[0].g() < (float)zhz.c) {
         var0[0].b((float)zhz.c);
      }

      if (var0[0].l() > (float)(var1.a() - zhz.c)) {
         var0[0].a((float)(var1.a() - zhz.c) - var0[0].h());
      }

      if (var0[0].m() > (float)(var1.b() - zhz.c)) {
         var0[0].b((float)(var1.b() - zhz.c) - var0[0].i());
      }

   }

   static String a(zxx var0, Object var1, String var2, boolean var3) {
      if (var1 == null) {
         return "";
      } else if (var2 == null && var1 != null) {
         return com.aspose.cells.b.a.zr.a(var1);
      } else {
         String var4 = "";
         int var5 = zamo.a(var1.getClass());
         if (a(var2) && (var5 == 14 || var5 == 9)) {
            double var6;
            DateTime var8;
            switch(var5) {
            case 9:
               var6 = (double)(Integer)var1;
               var8 = a(var6);
               if (com.aspose.cells.b.a.ze.f(var1) == 60) {
                  var4 = zgc.a(var0, var1, var2);
                  if (var2.indexOf("d") >= 0 && var4.indexOf("28") >= 0) {
                     var4 = com.aspose.cells.b.a.zv.a(var4, "28", "29");
                  }

                  return var4;
               }

               return zgc.a(var0, var8, var2);
            case 14:
               var6 = (Double)var1;
               var8 = a(var6);
               return zgc.a(var0, var8, var2);
            }
         }

         var4 = zgc.a(var0, var1, var2);
         return var4;
      }
   }

   static Color a(Object var0, String var1, Color var2) {
      if (var0 != null) {
         if (var1 == null || "".equals(var1)) {
            return var2;
         }

         int var3 = zamo.a(var0.getClass());
         if ((var3 == 14 || var3 == 9) && var1.toLowerCase().indexOf("[red]") > 0) {
            return com.aspose.cells.b.a.ze.g(var0) < 0.0D ? Color.getRed() : var2;
         }
      }

      return var2;
   }

   static boolean a(Object var0, String var1) {
      if (var0 == null) {
         return false;
      } else if (var1 != null && !"".equals(var1)) {
         int var2 = zamo.a(var0.getClass());
         return (var2 == 14 || var2 == 9) && var1.toLowerCase().indexOf("[red]") > 0 && (Double)var0 < 0.0D;
      } else {
         return false;
      }
   }

   private static boolean a(String var0) {
      String[] var1 = new String[]{"MMM", "DD", "YYYY", "M/", "/M", "/D", "D/", "/Y", "Y/", "-M", "M-", "-D", "D-", "-Y", "Y-", "MM/DD", "DD/MM", "M/D", "D/M", "MM-DD", "DD-MM", "M-D", "D-M", "H:MM", "MM:SS", "年", "月", "日", "时", "分", "秒", "MM"};

      for(int var2 = 0; var2 < var1.length; ++var2) {
         if (var0.indexOf(var1[var2]) != -1 || var0.toUpperCase().indexOf(var1[var2]) != -1) {
            return true;
         }
      }

      return false;
   }

   private static DateTime a(double var0) {
      DateTime var2 = new DateTime(1899, 12, 30, 0, 0, 1);
      if (var0 < 0.0D) {
         return var2;
      } else if (var0 > 2958465.99D) {
         return new DateTime(9999, 12, 31, 23, 59, 59);
      } else {
         if (var0 < 60.0D) {
            ++var0;
         }

         DateTime var3 = com.aspose.cells.a.c.zk.a(var2, com.aspose.cells.b.a.zk.a(var0));
         return var3;
      }
   }

   static boolean a(int var0) {
      return var0 == 60 || var0 == 12;
   }

   static int b(int var0) {
      switch(var0) {
      case 0:
      case 1:
      case 2:
      case 3:
      case 4:
      case 5:
      case 7:
      case 8:
      case 10:
      case 11:
      case 15:
      case 16:
      case 19:
      case 20:
      case 22:
      case 23:
      case 25:
      case 26:
      case 29:
      case 30:
      case 32:
      case 33:
      case 35:
      case 36:
      case 51:
      case 52:
      case 54:
      case 55:
         return 1;
      case 6:
      case 9:
      case 14:
      case 17:
      case 18:
      case 21:
      case 24:
      case 27:
      case 28:
      case 31:
      case 34:
      case 50:
      case 53:
      case 56:
         return 4;
      case 12:
      case 13:
      case 37:
      case 38:
      case 39:
      case 40:
      case 41:
      case 42:
      case 43:
      case 60:
      case 61:
      case 62:
      case 63:
      case 64:
         return 8;
      case 44:
      case 45:
      case 46:
      case 47:
      case 48:
      case 49:
         return 4;
      case 57:
      case 58:
      case 59:
      default:
         return 1;
      }
   }

   public static void a(zn var0, zpt var1, com.aspose.cells.b.a.b.zp var2, String var3, int var4, com.aspose.cells.b.a.b.zg var5, Color var6, int var7, int var8) {
      boolean var9 = false;
      int var10 = var0.j();
      if (var1.a().a().i().d().g() && var1.a().d().g() && var0.j() != 4) {
         var0.b(4);
         var9 = true;
      }

      com.aspose.cells.b.a.b.zv var11 = new com.aspose.cells.b.a.b.zv();
      var11.a(zbsp.a(var7));
      var11.c(zbsp.a(var8));
      switch(Math.abs(var4)) {
      case 0:
         var0.a(var3, var5, new com.aspose.cells.b.a.b.zu(var6), (com.aspose.cells.b.a.b.zp)var2, var11);
         break;
      case 90:
         var0.b((float)(var2.g() + var2.e() / 2), (float)(var2.h() + var2.f() / 2));
         var0.a((float)(-var4));
         var2 = new com.aspose.cells.b.a.b.zp(-var2.f() / 2, -var2.e() / 2, var2.f(), var2.e());
         var0.a(var3, var5, new com.aspose.cells.b.a.b.zu(var6), (com.aspose.cells.b.a.b.zp)var2, var11);
         var0.d();
         break;
      default:
         double var12 = Math.sqrt(Math.pow((double)var2.e(), 2.0D) + Math.pow((double)var2.f(), 2.0D));
         var11.b(4096);
         com.aspose.cells.b.a.b.zt var14 = var0.a(var3, var5, (int)var12, var11);
         var0.b((float)(var2.g() + var2.e() / 2), (float)(var2.h() + var2.f() / 2));
         var0.a((float)(-var4));
         com.aspose.cells.b.a.b.zq var15 = new com.aspose.cells.b.a.b.zq(-var14.b() / 2.0F, -var14.c() / 2.0F, var14.b(), var14.c());
         var0.a(var3, var5, new com.aspose.cells.b.a.b.zu(var6), (com.aspose.cells.b.a.b.zq)var15, var11);
         var0.d();
      }

      if (var9 && var0.j() != var10) {
         var0.b(var10);
      }

   }
}
